#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QMessageBox>
#include <openfetion.h>

namespace Ui {
    class MainWindow;
	class Login;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    Ui::MainWindow *mainUi;
	Ui::Login *loginUi;
	User *user;
	Config *config;
	
private:
	void generate_pic_code(User* user);
	unsigned char* decode_base64(const char* in , int* len);
	char* get_ip_by_name(const char* hostname);
	char* http_connection_get_response(FetionConnection* conn);
	
	void showMsg(QString msg)
	{
		QMessageBox::information(this, tr("信息"), msg, tr("确定"));
	}

	void showWarn(QString warn)
	{
		QMessageBox::warning(this, tr("警告"), warn, tr("确定"));
	}
	
	void showError(QString error)
	{
		QMessageBox::warning(this, tr("错误"), error, tr("确定"));
	}
	
private slots:
	int login();
};

#endif // MAINWINDOW_H
